
<div class="row">
    <div class="col-md-8">
        <div class="panel">
            <div class="panel-body">
        <dl>
            <dt>
                Description lists
            </dt>
            <dd>
                A description list is perfect for defining terms.
            </dd>
            <dt>
                Euismod
            </dt>
            <dd>
                Vestibulum id ligula porta felis euismod semper eget lacinia odio sem nec elit.
            </dd>
            <dd>
                Donec id elit non mi porta gravida at eget metus.
            </dd>
            <dt>
                Malesuada porta
            </dt>
            <dd>
                Etiam porta sem malesuada magna mollis euismod.
            </dd>
            <dt>
                Felis euismod semper eget lacinia
            </dt>
            <dd>
                Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo
                sit amet risus.
            </dd>
        </dl>
                </div>
            </div>
    </div>
    <div class="col-md-4">
        <form role="form" id="sign-up" method="post" action="#">
            <h2>Sign Up Now!</h2>

            <div id="error" class="alert alert-danger" role="alert" style="display: none;">
            </div>
            <div class="form-group">

                <label for="email">
                    Email address
                </label>
                <input class="form-control" id="email" name="email" type="email"/>
            </div>
            <div class="form-group">

                <label for="password">
                    Password
                </label>
                <input class="form-control" id="password" name="password" type="password"/>
            </div>
        </form>
        <button id="submitBtn" class="btn btn-default">
            Submit
        </button>
    </div>
</div>
<div class="row">
    <div class="col-md-4">
        <div class="panel panel-default">
            <div class="panel-body">
                <dl>
                    <dt>
                        Description lists
                    </dt>
                    <dd>
                        A description list is perfect for defining terms.
                    </dd>
                    <dt>
                        Euismod
                    </dt>
                    <dd>
                        Vestibulum id ligula porta felis euismod semper eget lacinia odio sem nec elit.
                    </dd>
                    <dd>
                        Donec id elit non mi porta gravida at eget metus.
                    </dd>
                    <dt>
                        Malesuada porta
                    </dt>
                    <dd>
                        Etiam porta sem malesuada magna mollis euismod.
                    </dd>
                    <dt>
                        Felis euismod semper eget lacinia
                    </dt>
                    <dd>
                        Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa
                        justo
                        sit amet risus.
                    </dd>
                </dl>
            </div>
        </div>
    </div>
    <div class="col-md-4">
        <div class="panel panel-default">
            <div class="panel-body">
                <dl>
                    <dt>
                        Description lists
                    </dt>
                    <dd>
                        A description list is perfect for defining terms.
                    </dd>
                    <dt>
                        Euismod
                    </dt>
                    <dd>
                        Vestibulum id ligula porta felis euismod semper eget lacinia odio sem nec elit.
                    </dd>
                    <dd>
                        Donec id elit non mi porta gravida at eget metus.
                    </dd>
                    <dt>
                        Malesuada porta
                    </dt>
                    <dd>
                        Etiam porta sem malesuada magna mollis euismod.
                    </dd>
                    <dt>
                        Felis euismod semper eget lacinia
                    </dt>
                    <dd>
                        Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa
                        justo
                        sit amet risus.
                    </dd>
                </dl>
            </div>
        </div>
    </div>
    <div class="col-md-4">
        <div class="panel panel-default">
            <div class="panel-body">
                <dl>
                    <dt>
                        Description lists
                    </dt>
                    <dd>
                        A description list is perfect for defining terms.
                    </dd>
                    <dt>
                        Euismod
                    </dt>
                    <dd>
                        Vestibulum id ligula porta felis euismod semper eget lacinia odio sem nec elit.
                    </dd>
                    <dd>
                        Donec id elit non mi porta gravida at eget metus.
                    </dd>
                    <dt>
                        Malesuada porta
                    </dt>
                    <dd>
                        Etiam porta sem malesuada magna mollis euismod.
                    </dd>
                    <dt>
                        Felis euismod semper eget lacinia
                    </dt>
                    <dd>
                        Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa
                        justo
                        sit amet risus.
                    </dd>
                </dl>
            </div>
        </div>
    </div>
</div>

<script>
    $(function () {
        $("#submitBtn").bind("click", function () {
            $.post('/user/signup?ts=' + new Date().getTime(), $("#sign-up").serialize(), function (data) {
                var errDiv = $("#error");
                if (data instanceof Array) {
                    //render error msg
                    errDiv.empty();
                    data.forEach(function(o) {
                        errDiv.append('<div>'+ o.error + '</div>');
                    });
                    errDiv.show();
                    return;
                }
                //register without errors, redirect to profile page.
                errDiv.hide();
                window.location.href = "/profile/edit";
            });
        });
    });
</script>